package com.zdp.course.controller;

import com.zdp.course.service.CourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 类描述: 提供课程信息
 *
 * @author ZhhengDP
 * @since 2021/8/16
 */
@RestController
@RequestMapping(value = "/course_info")
public class CourseController {

    private CourseService courseService;
    @Autowired
    public CourseController(CourseService courseService){
        this.courseService = courseService;
    }

    @RequestMapping(value = "/courses",method = RequestMethod.GET)
    public List<CourseDto> getCoursesByTeacherId(@RequestParam("teacherId") Integer teacherId){
        return courseService.getCoursesByTeacherId(teacherId);
    }
}
